package ${(introspectedTable.tableConfiguration.properties.fileDirectoryApi)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryApi)?index_of("/src/main/java/")+15))?replace("/",".")};


import com.broker.framework.common.pojo.CommonResult;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/***
 * ---------------------------
 * @Description: 表备注：${introspectedTable.remarks!}<#--deal null-->
 * 针对表【${introspectedTable.tableConfiguration.schema!}.${introspectedTable.fullyQualifiedTable.introspectedTableName}】的Api
 * ---------------------------
 * @author: ${introspectedTable.tableConfiguration.properties.auther!}
 * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
 * @version: v1.0
 * ---------------------------
 */
@FeignClient(name = ApiConstants.NAME,contextId = "${className}Api")
@Tag(name = "RPC 服务 - ${introspectedTable.fullyQualifiedTable.introspectedTableName} - ${introspectedTable.remarks!}")
@Validated
public interface ${className}Api {
    TODO this thing.
    //先检查表是否有tenant_id字段，如果没有则需要在 service层的 application.yaml 添加表忽略配置 ${introspectedTable.fullyQualifiedTable.introspectedTableName}
    //首次创建类，务必在对应orch层的RpcConfiguration中配置@EnableFeignClients，clients增加 ${className}Api.class

    String PREFIX = ApiConstants.PREFIX + "/${introspectedTable.fullyQualifiedTable.introspectedTableName?replace("_","-")}";

    /***
     * ---------------------------
     * @Description: 根据id获取
     * ---------------------------
     * @Param:  * @param ${classNameTuoFeng}Id
     * @return: CommonResult<${className}DTO>
     * ---------------------------
     * @author: ${introspectedTable.tableConfiguration.properties.auther!}
     * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
     * @version: v1.0
     * ---------------------------
     */
    @GetMapping(PREFIX + "/{id}")
    CommonResult<${className}DTO> get(@PathVariable(value = "id") Long id);

<#list introspectedTable.nonPrimaryKeyColumns as baseColumns>
    <#--这里仅暂时兼容不符合规范的字段，（以下划线结尾的） ............. start.-->
        <#if baseColumns.actualColumnName?last_index_of("_id")!=-1 && baseColumns.actualColumnName !="tenant_id">
    @GetMapping(PREFIX + "/get-by-${baseColumns.javaProperty?cap_first}")
    CommonResult<List<${className}DTO>> getBy${baseColumns.javaProperty?cap_first}(@RequestParam("${baseColumns.javaProperty}") ${baseColumns.fullyQualifiedJavaType.shortNameWithoutTypeArguments} ${baseColumns.javaProperty});
        </#if>
</#list>

}